package com.task.poker.card.container;

import com.task.poker.card.abs.Card;
import com.task.poker.card.abs.CardType;
import com.task.poker.card.entity.*;

/**
 * Card factory.
 * @author	JiDong
 * @create	November 14.2019
 *
 */
public class CardFactory {

    public static Card newCard(int cardColor){
        if(CardType.CLUB.getCode() == cardColor) {
            return new ClubCard();
        }else if(CardType.HEART.getCode() == cardColor) {
            return new HeartCard();
        }else if(CardType.DIAMOND.getCode() == cardColor) {
            return new DiamondCard();
        }else if(CardType.SPADE.getCode() == cardColor) {
            return new SpadeCard();
        }else if(CardType.JOKE.getCode() == cardColor) {
            return new JokeCard();
        }
        return null;
    }

}
